package mobi.greenplate.theweb.converter;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;
import mobi.greenplate.theweb.domain.OfferRide;


@XmlRootElement(name="offerRide-list")
public class OfferRideListConverter {

    private final List<OfferRide> entities;

    public OfferRideListConverter() {
        this.entities=new ArrayList<OfferRide>();
    }
    
    public OfferRideListConverter(List<OfferRide> entities) {
        this.entities = entities;
    }

    @XmlElement
    public List<OfferRideConverter> getOfferRide(){
        final List<OfferRideConverter> list = new ArrayList<OfferRideConverter>();
        for (OfferRide offerRide : entities) {
            list.add(new OfferRideConverter(offerRide));
        }
        return list;
    }

    @XmlTransient
    public List<OfferRide> getEntities(){
        return Collections.unmodifiableList(this.entities);
    }

}


